<include file="common:__head__"/>
<div class="permissions-tabs">
    <a class="role tabs-bg" href="{:U('agent/upgrade')}">代理升级</a>
</div>
<div class="permissions-content">
    <div class="permissions-le">
        <div class="add-msg">
            <div class="add-form">
                <form method="get" action="" onsubmit="return false;">
                    <select id="st">
                        <option value="">是否通过</option>
                        <option value="1">是</option>
                        <option value="2">否</option>
                    </select>
                    <input type="hidden" name="m" value="seller"/>
                    <input type="hidden" name="c" value="agent"/>
                    <input type="hidden" name="a" value="upgrade"/>
                    <input type="hidden" id="orderby1" value="up_id"/>
                    <input type="hidden" id="orderby2" value="DESC"/>
                    <div class="add-ipt">
                        <input placeholder="姓名" type="text" id="mName" class="add-name" />
                        <button type="button" onclick="search_data();"></button>
                    </div>
                </form>
            </div>
        </div>

        <div class="permissions-table">
            <form action="{:U('Agent/batchDo')}" method="post" id="smt">
                <input type="hidden" name="type" value="" id="do_type"/>
                <table border="0" width="100%">
                    <thead>
                    <tr>
                        <td>ID</td>
                        <td>代理姓名</td>
                        <td>升级级别</td>
                        <td>原代理级别</td>
                        <td>备注</td>
                        <td>升级时间</td>
                        <td>状态</td>
                    </tr>
                    </thead>
                    <tbody class="trade-setting" id="ajax_return"></tbody>
                </table>
            </form>
        </div>
    </div>
    <div class="permissions-ri">
        <a href="" class="permissions-help">帮助和服务</a>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function(){
        // ajax 加载商品列表
        ajax_get_table(1);
    });
    // ajax 抓取页面 form 为表单id  page 为当前第几页
    function ajax_get_table(page){
        cur_page = page; //当前页面 保存为全局变量
        $.ajax({
            type : "POST",
            url:"{:U('Agent/ajax_up_list')}",
            data : {
                p :page,
                mName :$("#mName").val(),
                st :$("#st").val(),
                orderby1 :$("#orderby1").val(),
                orderby2 :$("#orderby2").val()
            },
            success: function(data){
                $("#ajax_return").html('');
                $("#ajax_return").append(data);
            }
        });
    }
    // 点击排序
    function sort(field)
    {
        $("#orderby1").val(field);
        var v = $("#orderby2").val() == 'desc' ? 'asc' : 'desc';
        $("#orderby2").val(v);
        ajax_get_table(cur_page);
    }
</script>
<include file="common:__foot__"/>